/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package crystall.lattincetypes;

import crystalllattincegenerator.CrystallLattince;
import crystalllattincegenerator.Point;
import crystall.lattinces.HexagonalLattince;
import crystall.lattinces.Lattince;

/**
 *
 * @author efma0714
 */
public class SimpleShingon implements Shingon{

    public SimpleShingon(Lattince l) {
        this.l = l;
    }   
    
    private Lattince l;

    @Override
    public void setLattince(Lattince l) {
        this.l = l;
    }

    @Override
    public Lattince getLattince() {
        return l;
    }

    @Override
    public CrystallLattince getCrystallLattince() {
        CrystallLattince cl = new CrystallLattince();
        
        double a = l.getA();
        double b = l.getB();
        double c = l.getC();
        double alpha = l.getAlpha()*Math.PI/180;
        double betta = l.getBetta()*Math.PI/180;
        double gamma = l.getGamma()*Math.PI/180;
        
        if(l instanceof HexagonalLattince)
        {
            
        }else
        {
            cl.add(new Point(0, 0, 0));
            cl.add(new Point(a, 0, 0));
            cl.add(new Point(a-b*Math.cos(gamma), Math.sin(gamma)*b, 0));
            cl.add(new Point(-b*Math.cos(gamma), Math.sin(gamma)*b, 0));
            
            cl.add(new Point(c*Math.cos(alpha), c*Math.cos(betta), c));
            cl.add(new Point(a+c*Math.cos(alpha), c*Math.cos(betta),c));
            cl.add(new Point(a+c*Math.cos(alpha)-b*Math.cos(gamma), Math.sin(gamma)*b+c*Math.cos(betta), c));//work?
            cl.add(new Point(c*Math.cos(alpha)-b*Math.cos(gamma), Math.sin(gamma)*b+c*Math.cos(betta), c));//work?
        }        
        return cl;
    }
    
}
